<?php
$awal = datefmysql($params['awal']);
$akhir = datefmysql($params['akhir']);
$adikAsuh = $params['AdikAsuh'];
$idAdikAsuh = $params['idAdikAsuh'];
$idTahunAjaran = $params['idTahunAjaran'];
$namaFile = 'log_adik_asuh.xls';

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

// header untuk nama file
header("Content-Disposition: attachment;
                filename=".$namaFile."");

header("Content-Transfer-Encoding: binary ");
?>
<html>
    <head>
        <title>Cetak Laporan Log Adik Asuh</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
    </head>
    <body>
        <table border="0">
            <tr bgcolor="#cccccc">
                <td colspan="8" align="center"><strong><font size="+1">Laporan Log Adik Asuh</font></strong></td>
            </tr>
            <tr bgcolor="#cccccc">
                <td colspan="8" align="center"><strong><font size="+1">Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></font></strong></td>
            </tr>
            <?php
              if($adikAsuh != ''){
            ?>
            <tr bgcolor="#cccccc">
                <td colspan="8" align="center"><strong><font size="+1">Nama Adik Asuh : <?php echo "$adikAsuh";?></font></strong></td>
            </tr>
            <?php
              }
            if($idTahunAjaran != ''){
                foreach ($tahunAjaran as $row);
            ?>
            <tr bgcolor="#cccccc">
                <td colspan="8" align="center"><strong><font size="+1">Tahun Ajaran : <?php echo $row['nama'].' '.$row['semester'];?></font></strong></td>
            </tr>
            <?php
            }
            ?>
        </table>
        <div class="data-list">
            <table class="tabel" style="width: 100%">
                <tr>
                    <th>No</th>
                    <th>Tanggal</th>
                    <th>Petugas</th>
                    <th>Adik Asuh</th>
                    <th>Sekolah</th>
                    <th>Kelas</th>
                    <th>Tahun Ajaran</th>
                    <th>Komentar</th>
                </tr>
                <?php
                    $no = 1;
                    foreach ($data as $rows){
                ?>
                <tr class="<?php echo ($no%2)?"even":"odd";?>">
                    <td style="text-align: center;width: 3%;"><?php echo $no++;?></td>
                    <td style="width: 10%"><?php echo datefmysql($rows['tanggal']);?></td>
                    <td style="width: 15%"><?php echo $rows['member'];?></td>
                    <td style="width: 15%"><?php echo $rows['adik_asuh'];?></td>
                    <td style="width: 20%"><?php echo $rows['sekolah'];?></td>
                    <td style="width: 5%"><?php echo $rows['kelas'];?></td>
                    <td style="width: 10%"><?php echo $rows['tahun_ajaran']." ".$rows['semester'];?></td>
                    <td style="text-align: justify"><?php echo $rows['komentar'];?></td>
                </tr>
                <?php
                    }
                ?>
            </table>
        </div>    
    </body>
</html>